<?
	/* Se asegura que el archivo es incluido por el index */
	defined( 'LOAD_MODULE_ACTION' ) or die( 'No esta permitido el acceso directo a ' . __FILE__ );
		$this->oTmpObject = new Banner_frm( $this );

	class Banner_frm extends Frm
	{
	function setValue ( $ncBanner )
		{
			$cSql = "SELECT ncBanner,ncTipoBanner,cdBanner,cDescripcion,cImagen,cLink,cCategoria
				FROM gtBanner
				WHERE ncBanner = '$ncBanner' ";
			$aDatos = $this->oDatabase->getArray($cSql);
			$this->setFieldsArray ( $aDatos );
		}
	function Banner_frm( &$oModule )
		{
			$this->Frm( $oModule );
			//Crea los Objetos de los campos de edicion
			$this->aFields['ncMenu']			= new InputNumber( "ncMenu" );
			$this->aFields['ncBanner']			= new InputNumber( "ncBanner" );
			$this->aFields['ncTipoBanner']		= new InputList( "ncTipoBanner" );
			$this->aFields['cdBanner']			= new InputText( "cdBanner" );
			$this->aFields['cDescripcion']		= new InputText( "cDescripcion" );
			$this->aFields['cImagen']			= new InputText( "cImagen" );
			$this->aFields['cLink']				= new InputText( "cLink" );
			$this->aFields['cCategoria']		= new InputText( "cCategoria" );
		}
	function setLevel( $nLevel)
		{
			switch ( $nLevel )
			{
				case 1:
					$this->aInput = array ( 'ncBanner', 'cdBanner', 'ncTipoBanner' );
					break;
				case 2:
					$this->aInput = array ('ncMenu','ncBanner','ncTipoBanner','cdBanner','cDescripcion','cImagen','cLink', 'cCategoria' );
					break;
			}
		}
	function initializeForm()
		{
			// Si viene el Ubicacion hace el retrieve
				if ( $this->isRetrievable() && $this->aFields['ncBanner']->getValue() )
				{
					$this->setValue( $this->aFields['ncBanner']->getValue() );
				}
			// Configura el Titulo
				$this->setLabel( "Banner" );
				$this->setMultilanguage();
			return true;
		}
	function initializeField( $cField , &$oField )
		{
			switch ( $cField )
			{
					case 'ncMenu':
						$oField->setHidden();
					break;
					case 'ncBanner':
						$oField->setHidden();
					break;
					case 'ncTipoBanner':
						$oField->setLabel('Tipo');
						$cSql = "SELECT ncTipoBanner, cdTipoBanner FROM gcTipoBanner";
						$oField->setMatrix($this->oDatabase->getMatrix($cSql));
						$oField->setMandatory($this->isMandatory);
					break;
					case 'cdBanner':
						$oField->setLabel('Banner');
						if ( $this->getOptionsLevel() == 2 ) $oField->setMultiLanguage();
					break;
					case 'cDescripcion':
						$oField->setLabel('Descripcion');
						if ( $this->getOptionsLevel() == 2 ) $oField->setMultiLanguage();
						$oField->setEditor();
					break;
					case 'cImagen':
						$oField->setLabel('Imagen');
					break;
					case 'cLink':
						$oField->setLabel('Link');
					break;
					case 'cCategoria':
						$oField->setLabel('Categoria');
						if ( $this->getOptionsLevel() == 2 ) $oField->setMultiLanguage();
					break;
			}
 		}
	}
?>